<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Login Page</title>
    <!-- 引入Layui CSS -->
    <link rel="stylesheet" href="../static/layui/css/layui.css">
    <style>
        body {
            background-color: #f2f2f2;
            display: flex;
            justify-content: center;
            align-items: center;
            min-height: 100vh;
            margin: 0;
        }
        .login-container {
            width: 350px;
            margin-top: -100px;
        }
        .login-title {
            text-align: center;
            margin-bottom: 30px;
            font-size: 24px;
            color: #333;
        }
        .layui-form-item {
            margin-bottom: 25px;
        }
        .login-footer {
            text-align: center;
            margin-top: 20px;
            color: #999;
        }
    </style>
</head>
<body>
    <div class="login-container">
        <h1 class="login-title">Login</h1>
        <form class="layui-form" action="/login" method="post">
            <div class="layui-form-item">
                <label class="layui-form-label">User Name</label>
                <div class="layui-input-block">
                    <input type="text" name="username" required lay-verify="required" placeholder="Please enter the username" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">Password</label>
                <div class="layui-input-block">
                    <input type="password" name="password" required lay-verify="required" placeholder="Please enter your password" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn layui-btn-fluid" lay-submit lay-filter="login">Login</button>
                </div>
            </div>
        </form>
        <div class="login-footer">
            © Inventory Management System
        </div>
    </div>

    <!-- 引入Layui JS -->
    <script src="../static/layui/layui.js"></script>
    <script>
        layui.use(['form', 'layer'], function(){
            var form = layui.form;
            var layer = layui.layer;

            // 表单提交
            form.on('submit(login)', function(data){
                // 这里可以添加AJAX登录逻辑
                // 示例：简单的表单提交
                return true;

            });

            // 按回车键提交表单
            $(document).keyup(function(event){
                if(event.keyCode === 13){
                    $("button[lay-filter='login']").click();
                }
            });
        });
    </script>
</body>
</html>